﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using OpenExpressApp.Module.WPF;
using Csla.Core;
using OpenExpressApp.Editors;

namespace OpenExpressApp.Module.WPF.Editors
{
    class GDataGridMemoColumn : OpenDataGridColumn
    {
        private MemoPropertyEditor _editor;

        public override IWPFPropertyEditor Editor
        {
            get
            {
                return this._editor;
            }
        }

        public GDataGridMemoColumn(BusinessObjectPropertyInfo info, IListObjectView view)
            : base(info, view)
        {
            this._editor = new MemoPropertyEditor(this.PropertyInfo,this.View);
        }

        protected override FrameworkElement GenerateElement(DataGridCell cell, object dataItem)
        {
            FrameworkElement fe = (_editor as IWPFPropertyEditor).ReadOnlyControlGenerator.CreateControl();
            fe.Width = EditorConst.MemoEditorWidth;
            return fe;
        }

        protected override FrameworkElement GenerateEditingElement(DataGridCell cell, object dataItem)
        {
            FrameworkElement fe = base.GenerateEditingElement(cell, dataItem);
            fe.Width = EditorConst.MemoEditorWidth;
            return fe;
        }
    }
}